#include <vector>
#include <fstream>
#include <iostream>
using namespace std;

vector<int> solution(
  vector<int> capacities,
  vector<int> milks
) {
   /*
   i%3        (i+1) % 3
   0    ->    1
   1    ->    2
   2    ->    0

   */
  for (int i = 0; i < 100; ++i) {
    // i -> i + 1
    int from = i % 3;
    int to = (i + 1)  % 3;

    int amount = min(milks[from], capacities[to] - milks[to]);
    milks[from] -= amount;
    milks[to] += amount;
  }

  return milks;
}

int main(int argc, char const *argv[])
{
  auto ans = solution({10, 11, 12}, {7, 7, 7});
  for (int n : ans) {
    cout << n << " ";
  }
  cout << endl;
  
  return 0;
}

